#include<iostream>
using namespace std;
#include<vector>
#include<fstream>

class Exchange {
public:
    int countWays(vector<int> changes, int n, int x) {
        // int ret = myRecur(changes,n,0,x);
        // int ret = mydp1(changes,n,x);
        int ret = mydp2(changes,n,x);
        return ret;
    }
    //changes,n:数组信息 index:表明从index~end 
    int myRecur(const vector<int>& changes, int n, int index, int rest) {
        if(rest == 0) {
            return 1;
        }
        if(index >= n || rest < 0) {
            return 0;
        }
        int ret = 0;
        int amount = 0;
        int new_rest = rest - amount*changes[index];
        while(new_rest >= 0) {
            ret += myRecur(changes,n,index+1,new_rest);
            amount++;
            new_rest = rest - amount*changes[index];
        }
        return ret;
    }

    int mydp1(const vector<int>& changes, int n, int rest) {
        int dp[110][10010]; //dp[index][rest]
        // cout << "in" <<endl;
        for(int i = 0; i < 110; i++) {
            for(int j = 0; j < 10010; j++) {
                dp[i][j] = 0;
            }
        }
        for(int irest = 0; irest <= rest; irest++) {
            dp[n][irest] = 0;
        }
        dp[n][0] = 1;
        for(int in = n-1; in >= 0; in--) {
            for(int irest = 0; irest <= rest; irest++) {
                int amount = 0;
                int new_rest = irest - amount * changes[in];
                while(new_rest >= 0) {
                    dp[in][irest] += dp[in+1][new_rest];
                    amount++;
                    new_rest = irest - amount * changes[in];
                }
            }
        }
        return dp[0][rest];
    }
    //斜率优化 发现当前求解方块依赖多个上级方块
    int mydp2(const vector<int>& changes, int n, int rest) {
        int dp[110][10010]; //dp[index][rest]
        for(int i = 0; i < 110; i++) {
            for(int j = 0; j < 10010; j++) {
                dp[i][j] = 0;
            }
        }
        dp[n][0] = 1;
        for(int in = n-1; in >= 0; in--) {
            for(int irest = 0; irest <= rest; irest++) {
                dp[in][irest] = dp[in+1][irest];
                if(irest >= changes[in]) {
                    dp[in][irest] += dp[in][irest-changes[in]];
                }
            }
        }
        return dp[0][rest];
    }
};


ifstream in("in.txt");
int main() {
    int n,x;
    vector<int> changes;
    in >> n;
    for(int i = 0; i < n; i++) {
        int tem;
        in >> tem;
        changes.push_back(tem);
    }
    in >> x;
    int ret = Exchange().countWays(changes,n,x);
    cout << "ret:" << ret << endl;
    return 0;
}